﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using RegisterWeb.Manager.RegistrationFeeManager.ashx;
using Register.BLL;
using Register.Model;
using System.Web.Script.Serialization;

namespace RegisterWeb.Manager.HospitalManager.ashx
{
    /// <summary>
    /// HospitalInfoService 的摘要说明
    /// </summary>
    public class HospitalInfoService : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            List<HospitalInfo> list = new List<HospitalInfo>();
            list = HospitalInfoBLL.GetHospitalInfos();
            List<HosptialItem> itemList = new List<HosptialItem>();
            string action = context.Request["action"];
            if (action != null)
            {
                if (action.Equals("search"))
                    itemList.Add(new HosptialItem("", "请选择", true));
            }

            foreach (HospitalInfo info in list)
            {
                itemList.Add(new HosptialItem(info.Hospital_ID, info.Hospital_Name, false));
            }
            JavaScriptSerializer jss = new JavaScriptSerializer();
            context.Response.Write(jss.Serialize(itemList));
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}